#include <iostream>

using namespace std;

const int N = 100;

int q[N][N];

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int n, m;

int main()
{
	cin >> n >> m;
	
	 int x = 0;
	 int y = 0;
	
	for (int i = 1, d = 0; i <= n * m; i ++ )
	{
		q[x][y] = i;
		
		int ax = x + dx[d];
		int ay = y + dy[d];
		
		if(ax < 0 || ax >= n || ay >= m || ay < 0 || q[ax][ay] != 0)
		{
			d = (d + 1) % 4;
			
			ax = x + dx[d];
			ay = y + dy[d];
		}
		
		x = ax;
		y = ay;
	} 
	
	for (int i = 0; i < n; i ++ )
	{
		for (int j = 0; j < m; j ++ )
		{
			cout << q[i][j] << ' ';
		}
		
		puts("");
	}
	
	return 0;
} 
